package com.yonyou.crm.sys.modules.rmimpl;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.yonyou.crm.sys.modules.entity.BiztypeRoleVO;
import com.yonyou.crm.sys.modules.entity.LayoutAssignmentVO;
import com.yonyou.crm.sys.modules.entity.LayoutCatalogVO;
import com.yonyou.crm.sys.modules.entity.LayoutVO;
import com.yonyou.crm.sys.modules.rmitf.ILayoutRmService;
import com.yonyou.crm.sys.modules.service.BiztypeRoleBizServiceImpl;
import com.yonyou.crm.sys.modules.service.LayoutBizServiceImpl;
import com.yonyou.crm.sys.modules.service.LayoutCatalogBizServiceImpl;
import com.yonyou.crm.sys.modules.service.RelationLayoutBizServiceImpl;

	
@Service
public class LayoutRmServiceImpl implements ILayoutRmService {
	
	@Autowired
	private LayoutBizServiceImpl bizService;
	
	@Autowired 
	private LayoutCatalogBizServiceImpl layoutCatalogBizServiceImpl;
	
	@Autowired 
	private RelationLayoutBizServiceImpl relationLayoutBizServiceImpl ;
	
	@Autowired
	private BiztypeRoleBizServiceImpl biztypeRoleService;	
	@Override
	public List<LayoutVO> getLayoutList(Long objId) {
		return bizService.getLayoutList(objId);
	}

	@Override
	public LayoutVO getLayout(Long id) {
		return bizService.getLayout(id);
	}
	
	@Override
	public LayoutVO addLayout(LayoutVO layoutVO) {
		return bizService.saveLayout(layoutVO);
	}
	@Override
	public LayoutVO updateLayout(LayoutVO layoutVO) {
		return bizService.updateLayout(layoutVO);
	}

	@Override
	public void assignLayouts(Integer clientType, Integer layoutType,List<LayoutAssignmentVO> assignmentVOs) {
		 bizService.saveLayoutAssignment(clientType, layoutType,assignmentVOs);
	};

	@Override
	public void deleteLayout(Long id) {
		bizService.deleteLayout(id);
	}
	
	@Override
	public List<LayoutCatalogVO> getLayoutCatalogList(Long objId) {
		return layoutCatalogBizServiceImpl.getLayoutCatalogList(objId);
	}
	
	@Override
	public List<Map<String, Object>>  getRelatedObjects(Long objId) {
		return relationLayoutBizServiceImpl.getRelatedObjects(objId);
	}
	
	@Override
	public Map<String, Object> getAssignmentTemplate(Long objId, Integer clientType,Integer layoutType ) {
		return bizService.getAssignmentTemplate(objId, clientType, layoutType);
	}

	@Override
	public LayoutVO getDefaultLayout(Long objId, Integer clientType,
			Integer layoutType) {
		return bizService.getDefaultLayout(objId, clientType, layoutType);
	}

	@Override
	public void disableLayout(Long layoutId) {
		bizService.saveLayoutDisableStatus(layoutId);
	}

	@Override
	public void enableLayout(Long layoutId) {
		bizService.saveLayoutEnableStatus(layoutId);
	}

	@Override
	public List<BiztypeRoleVO> getAssignRoles(Map<String, Object> param) {
		return biztypeRoleService.getAssignRoles(param);
	}
}
